package org.example.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.example.entity.Notify;

import java.util.List;

@Mapper
public interface NotifyMapper extends BaseMapper<Notify> {
    @Select("SELECT * FROM notify n\n" +
            "        WHERE NOT EXISTS\n" +
            "            (SELECT 1 FROM notify_view_record nvr\n" +
            "            WHERE n.id = nvr.n_id AND nvr.u_id = #{uId})")
    List<Notify> selectUnreadMsgListByUId(@Param("uId") Integer uId);
}